<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
		<title>软件下载设置</title>
		<link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
		<link rel="stylesheet" href="/static/web/css/bootstrap.min.css">
		<link rel="stylesheet" href="/static/web/css/admin.css">
		<script src="/static/web/js/jquery.min.js"></script>
		<script src="/static/web/js/bootstrap.min.js"></script>
		<script src="/static/web/js/admin.main.js"></script>
	</head>
	<body>
		<form name="form1" action="soft_config.php" method="post">
			<input type="hidden" name="dopost" value="save">
			<table class="table shadow-sm my-3">
				<tr>
					<td colspan="2">软件下载设置</td>
				</tr>
				<tr>
					<td width="260">链接显示方式：</td>
					<td>
						<label><input type="radio" name="gotojump" value="0" <?php if ($row['gotojump']==0) echo " checked ";?>> 真实软件链接地址</label>
						<label><input type="radio" name="gotojump" value="1" <?php if ($row['gotojump']==1) echo " checked ";?>> 字符软件链接地址</label>
					</td>
				</tr>
				<tr>
					<td>软件下载方式：</td>
					<td>
						<label><input type="radio" name="downtype" value="0" <?php if ($row['downtype']==0) echo " checked ";?>> 当前软件发布页</label>
						<label><input type="radio" name="downtype" value="1" <?php if ($row['downtype']==1) echo " checked ";?>> 链接到地址列表页</label>
					</td>
				</tr>
				<tr>
					<td>是否启用镜像站点：</td>
					<td>
						<label><input type="radio" name="ismoresite" value="1" <?php if ($row['ismoresite']==1) echo " checked ";?>> 启用</label>
						<label><input type="radio" name="ismoresite" value="0" <?php if ($row['ismoresite']==0) echo " checked ";?>> 不启用</label>
					</td>
				</tr>
				<tr>
					<td>启用镜像站点后是否保留本地下载：</td>
					<td>
						<label><input type="radio" name="islocal" value="1" <?php if ($row['islocal']==1) echo " checked ";?>> 保留</label>
						<label><input type="radio" name="islocal" value="0" <?php if ($row['islocal']==0) echo " checked ";?>> 不保留</label>
					</td>
				</tr>
				<tr>
					<td>镜像处理方式：</td>
					<td>
						<label><input type="radio" name="moresitedo" value="1" <?php if ($row['moresitedo']==1) echo " checked ";?>> 本地地址和服务器列表自动生成</label>
						<label><input type="radio" name="moresitedo" value="0" <?php if ($row['moresitedo']==0) echo " checked ";?>> 按服务器生成列表由我手工填写</label>
					</td>
				</tr>
				<tr>
					<td>下载默认等级：</td>
					<td>
						<select name="dfrank" id="dfrank" class="admin-input-sm">
							<?php
							$urank = $cuserLogin->getUserRank();
							$dsql->SetQuery("SELECT * FROM `#@__arcrank` WHERE `rank` >= 0 ");
							$dsql->Execute();
							while($nrow = $dsql->GetArray())
							{
								if ($nrow['rank']==0) $nrow['membername'] = "开放下载";
								if ($nrow['rank']==$row['dfrank']) echo "<option value='{$nrow['rank']}' selected>{$nrow['membername']}</option>";
								else echo "<option value='{$nrow['rank']}'>{$nrow['membername']}</option>";
							}
							?>
						</select>
					</td>
				</tr>
				<tr>
					<td>下载默认金币：</td>
					<td><input type="text" name="dfywboy" value="<?php echo $row['dfywboy'];?>" class="admin-input-xs">
					</td>
				</tr>
				<tr>
					<td>参数限制方式：</td>
					<td>
						<label><input type="radio" name="argrange" value="0" <?php if ($row['argrange']==0) echo " checked ";?>> 所有软件重新选择权限</label>
						<label><input type="radio" name="argrange" value="1" <?php if ($row['argrange']==1) echo " checked ";?>> 所有软件均使用此权限</label>
					</td>
				</tr>
				<tr>
					<td>镜像服务器列表：</td>
					<td>
						<label>镜像域名：<input type="text" name="serverurl" id="serverurl"></label>
						<label>镜像目录：<input type="text" name="servername" id="servername"></label>
						<label>镜像名称：<input type="text" name="servertype" id="servertype" value="默认下载地址"></label>
						<button type="button" name="submit" onclick="AddServer();" class="btn btn-success btn-sm">添加一项</button>
					</td>
				</tr>
				<tr>
					<td colspan="2"><textarea name="sites" id="sites" class="admin-textarea-xl"><?php echo $row['sites'];?></textarea></td>
				</tr>
				<tr>
					<td colspan="2">下载说明：</td>
				</tr>
				<tr>
					<td colspan="2"><?php GetEditor('downmsg',$row['downmsg'],400);?></td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<button type="submit" name="submit" class="btn btn-success btn-sm">保存</button>
						<button type="reset" name="rset" id="rset" class="btn btn-outline-success btn-sm">重置</button>
					</td>
				</tr>
			</table>
		</form>
		<script>
			function AddServer() {
				if (document.form1.serverurl.value == "" || document.form1.serverurl.value == "") {
					ShowMsg('镜像域名不能为空');
					return;
				}
				if (document.form1.servername.value == "") {
					ShowMsg('镜像目录不能为空');
					return;
				}
				if (document.form1.servertype.value == "") {
					ShowMsg('镜像名称不能为空');
					return;
				}
				document.form1.sites.value += document.form1.serverurl.value + " | " + document.form1.servername.value + " | " + document.form1.servertype.value + "";
			}
		</script>
	</body>
</html>